home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
MonitorSimMux.cc,v
< prev
next >
Wrap
Text File
|
1989-03-23
|
2KB
|
133 lines
head 3.2;
branch ;
access ;
symbols ;
locks grunwald:3.2; strict;
comment @@;
3.2
date 89.02.20.15.36.13; author grunwald; state Exp;
branches ;
next 3.1;
3.1
date 88.12.20.13.49.00; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 88.10.30.13.03.13; author grunwald; state Exp;
branches ;
next ;
desc
@@
3.2
log
@Start using Gnu library heaps for schedulers
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#include "MonitorSimMux.h"
#include "SpinBarrier.h"
#include "Statistic.h"
#include "SpinFetchAndOp.h"
#include "Config.h"
static SpinLock statsLock;
static Statistic ThreadsPerTick;
static int threadsThisTick[MaxCpuMultiplexors];
extern int CpuMuxDebugFlag;
MonitorSimMux *ThisMonitorSimMux;
MonitorSimMux::MonitorSimMux(int debug, int maxloops) : (debug, maxloops)
{
pNameTemplate = "MonitorSimMux";
ThisMonitorSimMux = this;
sprintf(nameSpace, "[%s-%d] ", pNameTemplate, iYam);
pName = nameSpace;
}
void
MonitorSimMux::stirItAround()
{
while( ! *terminated )
{
CpuMultiplexor::stirItAround();
#ifndef NDEBUG
if (CpuMuxDebugFlag) {
CpuCerrLock.reserve();
cerr << name() << "Finished with current batch, advance time\n";
CpuCerrLock.release();
}
#endif /*NDEBUG*/
int added = advanceTime();
threadsThisTick[iYam] += added;
cpuBarrier -> rendezvous();
if (iYam == 0) {
int total = 0;
for (int i = 0 ; i < CpuMultiplexors; i++ ) {
total += threadsThisTick[i];
threadsThisTick[i] = 0;
}
double dtotal = double(total);
ThreadsPerTick += dtotal;
}
}
}
void
MonitorSimMux::coolItDown()
{
SimulationMultiplexor::coolItDown();
CpuCerrLock.reserve();
cerr << name() << "Statistics for threads per tick\n";
cerr << name() << ThreadsPerTick << "\n";
cerr << name() << "Min = " << ThreadsPerTick.min() << "\n";
cerr << name() << "Max = " << ThreadsPerTick.max() << "\n";
CpuCerrLock.release();
}
Statistic *
MonitorSimMux::threadsPerTick()
{
return (&ThreadsPerTick);
}
@
3.1
log
@Steay version
@
text
@@
1.1
log
@Initial revision
@
text
@d21 1
a21 1
MonitorSimMux::MonitorSimMux(int debug) : (debug)
d23 1
d25 2
@